]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Use MetaButtonLayout to get side of close button
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 28 Nov 2012 22:02:46 +0000 (23:02 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 9 Jan 2013 23:08:55 +0000 (00:08 +0100)
The current code parses the button-layout setting because MetaButtonLayout
was not usable from introspection. With that fixed, we can switch to
using meta_prefs_get_button_layout().

https://bugzilla.gnome.org/show_bug.cgi?id=689263

js/ui/workspace.js

index c026da8c4b280b486b4c1fda4c412857588f13f2..edcb04515082c92015e51595cccc149ca5da0dfb 100644 (file)
@@ -1,7 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const Clutter = imports.gi.Clutter;
-const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
@@ -30,9 +29,6 @@ const CLOSE_BUTTON_FADE_TIME = 0.1;
 
 const DRAGGING_WINDOW_OPACITY = 100;
 
-const BUTTON_LAYOUT_SCHEMA = 'org.gnome.shell.overrides';
-const BUTTON_LAYOUT_KEY = 'button-layout';
-
 // When calculating a layout, we calculate the scale of windows and the percent
 // of the available area the new layout uses. If the values for the new layout,
 // when weighted with the values as below, are worse than the previous layout's,
@@ -455,8 +451,6 @@ const WindowOverlay = new Lang.Class({
         this._parentActor = parentActor;
         this._hidden = false;
 
-        this._settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
-
         this.borderSize = 0;
         this.border = new St.Bin({ style_class: 'window-clone-border' });
 
@@ -549,15 +543,8 @@ const WindowOverlay = new Lang.Class({
         let button = this.closeButton;
         let title = this.title;
 
-        let layout = this._settings.get_string(BUTTON_LAYOUT_KEY);
-        let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
-
-        let split = layout.split(":");
-        let side;
-        if (split[0].indexOf("close") > -1)
-            side = rtl ? St.Side.RIGHT : St.Side.LEFT;
-        else
-            side = rtl ? St.Side.LEFT : St.Side.RIGHT;
+        let layout = Meta.prefs_get_button_layout();
+        let side = layout.left_buttons.indexOf(Meta.ButtonFunction.CLOSE) > -1 ? St.Side.LEFT : St.Side.RIGHT;
 
         let buttonX;
         let buttonY = cloneY - (button.height - button._overlap);